home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / 80X86 / DOS32V33.ZIP / EXAMPLES / EG3.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-08-25  |  1.6 KB  |  57 lines

  1. ;***************************************************************************
  2. ; EG3.ASM
  3. ;               This program will display all the environment varaibles
  4. ;
  5. ;
  6. ; DOS32 assembly language example program
  7. ;***************************************************************************
  8.  
  9. .386
  10. .model flat
  11. .stack 200h
  12. .code
  13.  
  14.  
  15. TheStart:                               ; Program starts execution here
  16.  
  17.  
  18.         mov     ax,0EE02h               ; Get DOS32 address info
  19.         int     31h                     ; EDI -> Environment segment
  20.  
  21.  
  22.  
  23. ;
  24. ;  Display the environment.
  25. ;
  26.  
  27. Plot_char_loop:
  28.         mov     dl,[edi]                ; read char from environment
  29.         inc     edi
  30.         cmp     dl, 0
  31.         je string_ended                 ; If char zero the string has ended.
  32.  
  33.           mov    ah,02h                 ; Set AH to video service func
  34.           int    21h                    ; Plot the character.
  35.           jmp Plot_char_loop            ; and continue loop.
  36.  
  37.       string_ended:
  38.  
  39.                 cmp     byte ptr [edi+1],0     ; If the next char is zero then
  40.                 jz     Exit_program            ; evnironmet has ended.
  41.                 mov     dl,10                  ; Else only string has ended
  42.                 mov     ah,2
  43.                 int     21h                    ; and print carrage return.
  44.                 mov     dl,13
  45.                 mov     ah,2
  46.                 int     21h
  47.                 jmp Plot_char_loop
  48.  
  49. Exit_program:
  50.  
  51.  
  52.     mov  ax,4c00h                         ; stop the program
  53.     int  21h
  54.  
  55.  
  56. END TheStart
  57.